const Stack = require('./stack.js');

function decimalToBinary(decNumber) {
  const remStack = new Stack();
  let number = decNumber;
  let rem;
  while (number > 0) {
    rem = Math.floor(number % 2);
    remStack.push(rem);
    number = Math.floor(number / 2);
  }

  let objString = '';
  while (!remStack.isEmpty()) {
    objString += remStack.pop();
  }
  return objString;
}


console.log('233 : ', decimalToBinary(233) === '11101001');
console.log('10 : ', decimalToBinary(10) === '1010');
console.log('1000 : ', decimalToBinary(1000) === '1111101000');

